home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LTP_FixExtraLabel.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  2KB  |  67 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. **
  6. **  :ts=4
  7. */
  8.  
  9. #include "gtlayout_global.h"
  10.  
  11. #ifdef DO_MENUS
  12.  
  13.     /* LTP_FixExtraLabel(RootMenu *Root,LONG *Error):
  14.      *
  15.      *    Fix up the submenu indicators and command labels.
  16.      */
  17.  
  18. VOID __regargs
  19. LTP_FixExtraLabel(RootMenu *Root,LONG *Error)
  20. {
  21.     ItemNode *Item;
  22.  
  23.         // Now take care of items which have command sequences
  24.         // or submenu items attached
  25.  
  26.     for(Item = (ItemNode *)Root -> ItemList . mlh_Head ; !(*Error) && Item -> Node . mln_Succ ; Item = (ItemNode *)Item -> Node . mln_Succ)
  27.     {
  28.             // Does this one need more label data?
  29.  
  30.         if(Item -> Flags & (ITEMF_HasSub | ITEMF_Command))
  31.         {
  32.             struct IntuiText *IntuiText;
  33.  
  34.             DB(kprintf("  attach to |%s|\n",((struct IntuiText *)Item -> Item . ItemFill) -> IText));
  35.  
  36.                 // Make room for the extra label data
  37.  
  38.             if(IntuiText = AsmAllocPooled(Root -> Pool,sizeof(struct IntuiText),SysBase))
  39.             {
  40.                     // Fill it in
  41.  
  42.                 LTP_InitIText(Root,IntuiText);
  43.  
  44.                     // Command sequence?
  45.  
  46.                 if(Item -> ExtraLabel)
  47.                 {
  48.                     IntuiText -> IText        = Item -> ExtraLabel;
  49.                     IntuiText -> ITextFont    = (struct TextAttr *)&Root -> BoldAttr;
  50.                 }
  51.                 else
  52.                     IntuiText -> IText = (STRPTR)"»";
  53.  
  54.                 IntuiText -> TopEdge = (Root -> ItemHeight - Root -> RPort . TxHeight) / 2;;
  55.  
  56.                     // Link to previous entry
  57.  
  58.                 ((struct IntuiText *)Item -> Item . ItemFill) -> NextText = IntuiText;
  59.             }
  60.             else
  61.                 *Error = ERROR_NO_FREE_STORE;
  62.         }
  63.     }
  64. }
  65.  
  66. #endif    /* DO_MENUS */
  67.